package ace.module.account.core.impl.manager.provider;

import ace.cmp.spring.util.core.LogUtils;
import ace.module.upms.api.UpmsApplicationApi;
import ace.module.upms.api.model.dto.UpmsApplicationDto;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * .
 * @author Caspar
 *
 */
@Slf4j
@AllArgsConstructor
@Component
public class UpmsApplicationProvider {

  private static final String SERVICE_EXCEPTION_MESSAGE = "权限应用服务调用失败";
  private final UpmsApplicationApi upmsApplicationApi;

  public UpmsApplicationDto getAndCheckNotNullAdminApplication() {
    UpmsApplicationDto upmsApplicationDto = LogUtils.logThrowExceptionOrDirectThrowBusinessException(
        SERVICE_EXCEPTION_MESSAGE,
        () -> this.upmsApplicationApi.getAndCheckNotNullAdminApplication().check()
    );
    return upmsApplicationDto;
  }
}
